package com.tanger.permission.mapper.role;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanger.permission.entity.role.EntityUserRole;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 数据持久接口层
 */
@Mapper
public interface UserRoleMapper extends BaseMapper<EntityUserRole>{

	@Insert({
			"<script>",
			"INSERT INTO brt_base_user_role(id, user_id , role_id) VALUES ",
				"<foreach item='item' collection='userRoles' separator=','>",
					"(#{item.id,jdbcType=BIGINT},#{item.userId,jdbcType=BIGINT},#{item.roleId,jdbcType=BIGINT})",
				"</foreach>",
			"</script>"
	})
	int batchInsert(@Param("userRoles") List<EntityUserRole> userRoles);
}
